Working with Shaders
Untold Engine's shaders are now open source and can be modified to suit your needs. All Metal shader files are compiled into a single ".metallib" file, which is then used by the Untold Engine. Here's how to work with shaders in the Untold Engine:
Modifying Existing Shaders
- Locate the shader file you wish to modify in the UntoldEngine/Shaders folder.
- Make your changes to the .metal file.
- Run the following command to recompile the shaders into the .metallib file:
make compile-shaders
- Build the engine to incorporate your changes:
swift build
Alternatively, you can call "make" to compile the shaders and build the engine
make
Adding New Shaders
If you want to add a new shader:
- Create a new .metal file in the UntoldEngine/Shaders folder.
- Open the UntoldEngineKernels.metal file located in the UntoldEngineKernels folder.
- Add an #include directive for your new shader file in UntoldEngineKernels.metal. For example:
#include "YourNewShaderFile.metal"
- Compile the shaders:
make compile-shaders
- Build the engine
swift build
Alternatively, you can call "make" to compile the shaders and build the engine
make
Cleaning Build Artifacts
If you encounter issues or want to reset the build, you can clean the build artifacts using:
make clean